const state = () =>({
  
  animateTitle1: false,
  animateTitle2: false,
  animateTitle3: false,
  animateTitle4: false,
})

const mutations = {
  SET_TITLE: (state, type) => {
      switch (type) {
        case 1: 
        state.animateTitle1 = true;
        break;
        case 2: 
        state.animateTitle2 = true;
        break;
        case 3: 
        state.animateTitle3 = true;
        break;
        case 4: 
        state.animateTitle4 = true;
        break;
      }
      console.log('title  ',state.animateTitle1)
    }
    
}

const actions = {
  generateTitle({ commit }, type) {
    return new Promise(resolve => {
      commit('SET_TITLE', type)
      resolve(type)
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
